<template lang="pug">
  .clearfix
    Modal(
      width="400"
      v-model="isCopyModal"
      title="选择账号"
      class-name="vertical-center-modal"
      @on-ok="ok"
      @on-cancel="cancel"
    )
      .search-form.mb-10.pl-10.pr-10.h32
        Col.pr-20.mb-15(span="7" style="width:300px")
          span.label-txt.w80 账号名称：
          Select(v-model="copyID" placeholder="请选择账号" filterable clearable )
            Option(v-for="(item, index) in userList" :value="item.id" :key="index") {{ item.name }}
</template>

<script>
import { SysDataPermissionApi } from '@/api/SysDataPermission.api.js'
import { constants } from 'fs';
export default {
  name: '',

  props: {
  },

  data () {
    return {
      isCopyModal: false,
      copyID: '',
      loading: false,
      PageIndex: 1,
      PageSize: 10,
      codeTotal: 0,
      idArr: [],
      userList: [],
      menuName: '',
      customerName: '',
      accountName: ''
    }
  },

  watch: {
  },

  mounted () {
    
  },

  methods: {
    ok () {
      let data = {
        "FromId": this.copyID,
        "ToIdList": this.idArr
      }
      SysDataPermissionApi.batchCopyUserPermission(data).then(res => {
        console.log(res,'SysDataPermissionApi')
        if (res.data.success) {
          this.$Message.success(res.data.message)
        } else {
          this.$Message.error(res.data.message)
        }
      })
    },

    cancel () {
    },
    
    serverDown () {
      let data = {
        pageIndex: 1,
        pageSize: 3000
      }
      SysDataPermissionApi.getUserNameList(data).then(res => {
        if (res.data.success) {
          this.userList = res.data.data
        } else {
          this.$Message.error({
            content: res.data.message,
            duration: 10,
            closable: true
          })
        }
      })
    },
  }
}
</script>

<style lang="less" scope>
</style>
